<%--
  Created by IntelliJ IDEA.
  User: 29238
  Date: 2021/5/16
  Time: 16:42
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>书籍借阅记录查询</title>
    <!-- 引入 Bootstrap -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>

<body>

<%--页面导航--%>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
    <!-- Brand -->
    <a class="navbar-brand" href="${pageContext.request.contextPath}/managers/homepage">Logo</a>

    <!-- Links -->
    <ul class="navbar-nav">
        <li class="nav-item">
            <a class="nav-link" href="${pageContext.request.contextPath}/book/allBook">书籍管理</a>
        </li>
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbardrop1" data-toggle="dropdown">
                用户管理
            </a>
            <div class="dropdown-menu">
                <a class="dropdown-item" href="${pageContext.request.contextPath}/user/allUser">借阅人管理</a>
                <a class="dropdown-item" href="${pageContext.request.contextPath}/managers/allManagers">管理员信息</a>
            </div>
        </li>

        <!-- Dropdown -->
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" href="#" id="navbardrop2" data-toggle="dropdown">
                借阅管理
            </a>
            <div class="dropdown-menu">
                <a class="dropdown-item" href="${pageContext.request.contextPath}/loan/toAddLoan">借阅办理</a>
                <a class="dropdown-item" href="${pageContext.request.contextPath}/view/allRecord">借阅查询</a>
            </div>
        </li>
    </ul>
</nav>
<br>
<%--页面导航--%>

<%-- boostrap主容器 --%>
<div class="container">

    <%-- 页面标题 --%>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>借阅记录查询</h1>
            </div>
        </div>
    </div>
    <%-- 页面标题 --%>

    <%-- 显示全部 --%>
    <div class="row">
        <div class="col-md-4 column">
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/view/allRecord">所有记录</a>
        </div>
    </div>
    <%-- 显示全部 --%>

    <form action="${pageContext.request.contextPath}/view/allRecordByClassNo" method="post">
        <div class="row">
            <div class="col-md-4 column">
                <label>
                    <input type="text" name="classNo" class="form-control" required>
                </label>
                <button class="btn btn-primary">按班级筛选</button>
            </div>
        </div>
    </form>

    <form action="${pageContext.request.contextPath}/view/allRecordByBookClassNo" method="post">
        <div class="row">
            <div class="col-md-4 column">
                <label>
                    <input type="text" name="classNo" class="form-control" required>
                </label>
                <button class="btn btn-primary">按书类别筛选</button>
            </div>
        </div>
    </form>


    <%-- 表格展示区域 --%>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">

                <%-- 表头 --%>
                <thead>
                <tr>
                    <th>学号</th>
                    <th>姓名</th>
                    <th>班级</th>
                    <th>专业</th>
                    <th>ISBN</th>
                    <th>书名</th>
                    <th>分类号</th>
                    <th>借阅日期</th>
                    <th>操作</th>
                </tr>
                </thead>
                <%-- 表头 --%>

                <%-- 表身 --%>
                <tbody>
                <%-- jstl的foreach标签迭代book对象的属性 --%>
                <%-- 可参考：https://www.runoob.com/jsp/jstl-core-foreach-tag.html --%>
                <c:forEach var="view" items="${list}">
                    <tr>
                        <td>${view.loanNo}</td>
                        <td>${view.loanName}</td>
                        <td>${view.classNo}</td>
                        <td>${view.major}</td>
                        <td>${view.ISBN}</td>
                        <td>${view.bookName}</td>
                        <td>${view.bookClassNo}</td>
                        <td>${view.borrowDate}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/loan/deleteLoan?loanNo=${view.loanNo}&ISBN=${view.ISBN}">归还</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
                <%-- 表身 --%>

            </table>
        </div>
    </div>
    <%-- 表格展示区域 --%>
</div>
<%-- boostrap主容器 --%>
</body>
</html>